"use strict"

/**
 * 葫芦岛市政府采购网爬虫
 *  
 */

var Base = require("./base");
var hld_spider = new Base();
hld_spider.name = "葫芦岛市政府采购网";
hld_spider.contentType = "text";
hld_spider.encode="GBK";


hld_spider.getPageUrl = function (pg) {
    return "http://www.hldggzyjyzx.com.cn/Front/jyxx/071002/071002001/?Paging=" + pg;
};

hld_spider.getItems = function (data) {
    var items = [];
    var reg = new RegExp("<a class=\"ellipsis\" href=\"(.*?)\"[\\s\\S]+?title=\"(.*?)\"", "ig");
    var regv;
    while (regv = reg.exec(data)) {
        var url = regv[1];
        var title = regv[2];
        var item = {};
        item.title = title;
        item.url = "http://www.hldggzyjyzx.com.cn" + url;
        item.source = hld_spider.name;
        items.push(item);
    }
    return items;
};

exports = module.exports = hld_spider;